package book;

/**
 * 书架
 */

public class BookList {
    private Book[] books = new Book[10];
    private int usedSize; //实时记录当前books这个数组中有多少本书

    //在实例化BookList时就在里面放几本书（因为目前还没有讲数据库）
    public BookList(){
        books[0] = new Book("三国演义","罗贯中",49,"小说",false);
        books[1] = new Book("西游记","吴承恩",29,"小说",false);
        books[2] = new Book("红楼梦","曹雪芹",59,"小说",false);
        usedSize = 3;
    }

    //pos位置为合法的，取到第pos位置的书信息
    public Book getBook(int pos){
        return books[pos];
    }

    //新增书 把book放到第pos个位置上
    public void setBooks(int pos,Book book){
        books[pos] = book;
    }

    //实时获取当前有几本书
    public int getUsedSize(){
        return usedSize;
    }

    //实时修改当前书架上书的数量
    public void setUsedSize(int size){
        usedSize = size;
    }

}
